package com.cxs.service.impl;

import com.cxs.anno.TargetDataSource;
import com.cxs.commons.DataSourceKey;
import com.cxs.domain.UserInfo;
import com.cxs.mapper.UserInfoDAO;
import com.cxs.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author:chenxiaoshuang
 * @Date:2019/5/14 18:24
 */
@Service
public class UserInfoServiceImpl implements UserInfoService {

    @Autowired
    private UserInfoDAO userInfoDAO;

    @TargetDataSource(dataSourceKey = DataSourceKey.DB_SLAVE)
    @Override
    public List<UserInfo> findAll() {
        return userInfoDAO.selectByExample(null);
    }

    @TargetDataSource(dataSourceKey = DataSourceKey.DB_SLAVE)
    @Override
    public int insert(UserInfo userInfo) {
        return userInfoDAO.insert(userInfo);
    }
}
